#include "BaseTile.h"

#include "../Tiny XML/tinyxml.h"
#include "../SGD Wrappers/CSGD_TextureManager.h"

#include <tchar.h>
#include <string>
#include <sstream>

using std::wostringstream;

CBaseTile::CBaseTile(void)
{
	m_nTokenID = Base_Tile;
	m_nTileID = Base;

	m_bIsOnScreen = true;
}

CBaseTile::~CBaseTile(void)
{
}

void CBaseTile::Update( float fElapsedTime )
{
	// If On Screen
	m_bIsOnScreen = true;

	if( m_bIsOnScreen )
	{
		BaseToken::Update( fElapsedTime );
	}
}

void CBaseTile::Render( void )
{
	if( m_bIsOnScreen )
	{
		RECT rSource = { m_nOffsetX, m_nOffsetY, m_nOffsetX + GetWidth(), m_nOffsetY + GetHeight() };
		POINT ptCenter = { (rSource.right - rSource.left) / 2, (rSource.bottom - rSource.top) / 2 };
		CSGD_TextureManager::GetInstance()->Draw( GetImageID(), (int)GetPosX(), (int)GetPosY(), 1.0f, 1.0f, &rSource, 
			float(ptCenter.x), float(ptCenter.y), 0 );
	}
}

RECT CBaseTile::GetRect( void )
{
	return BaseToken::GetRect();
}

bool CBaseTile::CheckCollision( BaseToken* pOther )
{
	
	return false;
}